﻿namespace Shapes.MyShapes
{
    using System;
    using System.Drawing;

    /// <summary>
    /// Class for Triangle
    /// </summary>
    public class TriAngle : Shape
    {
        #region Constructors

        /// <summary>
        /// Initialize new right triangle with rib=4,3,5
        /// </summary>
        public TriAngle()
            : this(4, 3, false, new Point(0, 0))
        {
        }

        /// <summary>
        /// Initialize new right triangle with height and width
        /// </summary>
        /// <param name="height">Height Value</param>
        /// <param name="width">Width Value</param>
        /// <param name="isFilled">Is this shape filled?</param>
        /// <param name="controlPoint">Control Point (X,Y)</param>
        public TriAngle(int height, int width, bool isFilled, Point controlPoint)
            : base(isFilled, controlPoint, height, width) { }

        #endregion

        #region Properties
        /*
        /// <summary>
        /// Point 2
        /// </summary>
        public Point Point2 { get; set; }

        /// <summary>
        /// Point 3
        /// </summary>
        public Point Point3 { get; set; }
        */
        #endregion

        #region Methods

        /// <summary>
        /// Draw Right Triangle
        /// </summary>
        public override void Draw()
        {
            for (int i = 0; i < ControlPoint.Y; i++)
            {
                Console.WriteLine();
            }

            for (int h = 0; h < Height; h++)
            {
                for (int j = 0; j < ControlPoint.X; j++)
                {
                    Console.Write(" ");
                }

                    for (int w = 0; w <= h; w++)
                    {
                        if (IsFilled)
                        {
                            Console.Write("*");
                        }
                        else
                        {
                            if ((w == 0) || (h == Height - 1) || (w == h))
                            {
                                Console.Write("*");
                            }
                            else
                            {
                                Console.Write(" ");
                            }
                        }
                    }
                Console.WriteLine();
            }
        }

        #endregion
    }
}
